package member.action;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.sql.Timestamp;

import member.dao.MemberDao;
import member.dto.MemberDto;

import com.opensymphony.xwork2.ActionSupport;

@SuppressWarnings("serial")
public class InputAction extends ActionSupport{
	
	private String id;
	private String password;
	private String name;
	private String tel;
	private String hp;
	private String address;
	private String email;
	private String email2;
	private Timestamp reg_date;
	private MemberDto paramClass;
	
	
	public String execute() throws Exception {

		paramClass = new MemberDto();
		paramClass.setId(getId());
		paramClass.setPassword(getPassword());
		paramClass.setName(getName());
		paramClass.setTel(getTel());
		paramClass.setHp(getHp());
		paramClass.SetAddress(getAddress());
		paramClass.setEmail(getEmail()+"@"+getEmail2());
		paramClass.setReg_date(new Timestamp(System.currentTimeMillis()));
				
		MemberDao.insertUser(paramClass);
		MemberDao.createTable(paramClass);

		String savePath="D:/itfinger/"+getId();
		File targetDir = new File(savePath);
		
		if(!targetDir.exists()){
			
			targetDir.mkdirs();
		}
		
		
		return "success";
		
	}
		public String getId(){
			return id;
		}
		public String getPassword(){
			return password;
		}
		public String getName(){
			return name;
		}
		public String getTel(){
			return tel;
		}
		public String getHp(){
			return hp;
		}
		public String getAddress(){
			return address;
		}
		public String getEmail(){
			return email;
		}
		public String getEmail2(){
			return email2;
		}
		public Timestamp getReg_date(){
			return reg_date;
		}
		public void setId(String id){
			this.id=id;
		}
		public void setPassword(String password){
			this.password = password;
		}
		public void setName(String name){
			this.name = name;
		}
		public void setTel(String tel){
			this.tel = tel;
		}
		public void setHp(String hp){
			this.hp = hp;
		}
		public void setAddress(String address){
			this.address = address;
		}
		public void setEmail(String email){
			this.email = email;
		}
		public void setEmail2(String email2){
			this.email2 = email2;
		}
		public void setReg_date(Timestamp reg_date){
			this.reg_date = reg_date;
		}
			
}


